#ifndef SERIAL_PORT_H
#define SERIAL_PORT_H

#include <QObject>
#include <QtSerialPort/QtSerialPort>

class serial_port : public QObject
{
    Q_OBJECT
public:
    explicit serial_port(QObject *parent=0);
   ~SPComm();
    bool isOpen() const;

    void setPortName(const QString $name);
    QString portName() const;

    void setBaudRate(int baudRate);
    int baudRate()const;

    virtual bool open();
    virtual void close();
    virtual bool clear();

    int reaadData(char *buffer,int count,int timeout=1000);
    int writeData(char *data,int size);
    int write(char ch);

protected:
    QString m_portName;
    int m_baudRate;
    QSerialPort *m_serialPort;
signals:
public slots:

};

#endif // SERIAL_PORT_H
